package com.zqweb.gulimall.cart.vo;

import lombok.ToString;

import java.math.BigDecimal;
import java.util.List;

/**
 * @Description: 购物项内容
 **/

@ToString
public class CartItemVo {
    // 商品id
    private Long skuId;
    // 是否选中
    private Boolean check = true;
    // 商品名称
    private String title;
    // 商品图片
    private String image;

    /**
     * 商品套餐属性
     */
    private List<String> skuAttrValues;

    // 商品单价
    private BigDecimal price;
    // 每类购物项的加购数量
    private Integer count;
    // 每类购物项的加购总价
    private BigDecimal totalPrice;

    public Long getSkuId() {
        return skuId;
    }

    public void setSkuId(Long skuId) {
        this.skuId = skuId;
    }

    public Boolean getCheck() {
        return check;
    }

    public void setCheck(Boolean check) {
        this.check = check;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getImage() {
        return image;
    }

    public void setImage(String image) {
        this.image = image;
    }

    public List<String> getSkuAttrValues() {
        return skuAttrValues;
    }

    public void setSkuAttrValues(List<String> skuAttrValues) {
        this.skuAttrValues = skuAttrValues;
    }

    public BigDecimal getPrice() {
        return price;
    }

    public void setPrice(BigDecimal price) {
        this.price = price;
    }

    public Integer getCount() {
        return count;
    }

    public void setCount(Integer count) {
        this.count = count;
    }

    /**
     * 计算当前购物项总价（采用BigDecimal，便于数字性数据的计算）
     * @return
     */
    public BigDecimal getTotalPrice() {
        // 每类商品项总价 = 商品加购数量 * 商品单价
        return this.price.multiply(new BigDecimal("" + this.count));
    }

    public void setTotalPrice(BigDecimal totalPrice) {
        this.totalPrice = totalPrice;
    }


}
